﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TextureSelection.ascx.cs" Inherits="Admin_Asp_UserControls_TextureSelection" %>

<asp:Panel ID="textureSelectionDiv" ClientIDMode="Static" runat="server" CssClass="selection">
    <div class="notice">
        <p>
            Here you can choose between already existing textures. Or you can upload a new texture to choose from. When you upload a new file you will choose it's name.
        </p>
    </div>
    <div class="selection_content">
        <h3 id="x_header" runat="server">Edit Texture</h3>
        <asp:Button ID="x_closeSelection" runat="server" OnClick="CloseSelection" Text="Hide Edit Texture" /><br /><br />
        <label class="labelHeader">Choose an existing textures</label> <br />
        <!-- The datalist -->
        <asp:DataList runat="server" id="x_selectionList" RepeatDirection="Horizontal"
                RepeatLayout="Table" OnSelectedIndexChanged="selectionList_Changed" OnItemCommand="selectionList_ItemCommand" RepeatColumns="10" >           
            <ItemStyle BorderColor="Silver" BorderWidth="2" />
            <ItemTemplate>            
                <asp:LinkButton runat="server" CommandName="select" Height="0">                                 
                    <asp:Image runat="server" ImageUrl='<%# Eval(Strings.Selection_ImageSrc,"~/Textures/{0}") %>' CssClass="thumbnail" />                
                </asp:LinkButton> 
                    <br />
            </ItemTemplate> 
            <SelectedItemStyle BorderColor="Red" BorderStyle="Solid" BorderWidth="2"   />         
            <SelectedItemTemplate>
                <asp:LinkButton runat="server" CommandName="unselect" >
                    <asp:Image ID="x_selectedItemImage" runat="server" ImageUrl='<%# Eval(Strings.Selection_ImageSrc,"~/Textures/{0}") %>' CssClass="thumbnail" />                
                </asp:LinkButton>
            </SelectedItemTemplate>         
        </asp:DataList>
        <asp:Panel ID="x_itemInfoPanel" runat="server" Visible="false">
            <label class="labelHeader">You have chosen:</label><br />
            <asp:Label ID="x_itemInfo_filename" runat="server" /> <br />
            <asp:Button ID="x_itemInfo_updateButton" runat="server" Text="Change Texture" OnClick="UpdateTexture" />
        </asp:Panel>
        <!-- end of datalist -->
        <!--<label class="labelHeader">Upload new texture:</label><br />-->
        <h2>Upload new texture:</h2>
        <label class="labelNotice">*.png,</label><br />
        <asp:FileUpload id="x_upload_file" runat="server" onchange='Gorbatras.Admin.FileControl.FileuploadChange(this, "x_upload_filename", [ ".png" ]  )' accept="image/*" /> <br />
        <label class="labelHeader">New filename:</label><br />
        <label class="labelNotice">Will be moved to textures/<strong>filename</strong></label><br />
        <asp:TextBox ID="x_upload_filename" runat="server" ClientIDMode="Static"/><br />
        <asp:Label ID="x_upload_error" runat="server" Visible="false" CssClass="validationError" /> <br />
        <asp:Button ID="x_upload_submit" runat="server" Text="Upload Texture" OnClick="TryToUpload" />  
    </div>
</asp:Panel>